import uvicorn
from fastapi import FastAPI
from tortoise.contrib.fastapi import register_tortoise

from routers.routers import router

app = FastAPI()

register_tortoise(
    app,
    db_url='mysql://root:diding2014@localhost:3306/jianglin',
    modules={'models': ['app.models.models']},
    generate_schemas=True,
    add_exception_handlers=True,
)


@app.get("/")
def index():
    return "it works!"


app.include_router(router)

# Add your routes and startup/shutdown events
if __name__ == '__main__':
    print("ovo started")
    uvicorn.run(app)
